package com.mingmen.canting.gongyingshang;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lzy.imagepicker.ImagePicker;
import com.lzy.imagepicker.bean.ImageItem;
import com.mingmen.canting.R;
import com.mingmen.canting.caigourenyuan.ChaKanZiZhiActivity;
import com.mingmen.canting.caigourenyuan.JuBaoActivity;
import com.mingmen.canting.caigourenyuan.JuBaoShangJiaActivity;
import com.mingmen.canting.http.callback.StringCallback;
import com.mingmen.canting.httpconfig.HttpResponse;
import com.mingmen.canting.model.PicSendModel;
import com.mingmen.canting.util.GsonUtil;
import com.mingmen.canting.util.SharePreferenceUtil;

import java.io.File;
import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import okhttp3.Call;
import okhttp3.Response;

@SuppressLint("ValidFragment")
public class ShangJiaFragment extends Fragment {


    @BindView(R.id.text_address)
    TextView textAddress;
    @BindView(R.id.text_Category)
    TextView textCategory;
    @BindView(R.id.lable_selectcanting)
    LinearLayout lableSelectcanting;
    Unbinder unbinder;
    String addressStr;
    String categoryStr;
    @BindView(R.id.layout_ziZhi)
    LinearLayout layoutZiZhi;
    @BindView(R.id.layout_jubao)
    LinearLayout layoutJubao;
    String supplierId;
    private int resurtResurant = 100;

    public static ShangJiaFragment getInstance(String title) {
        ShangJiaFragment sf = new ShangJiaFragment();

        return sf;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    String shippingFee;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fr_shangjia, null);
        unbinder = ButterKnife.bind(this, v);
        addressStr = (String) SharePreferenceUtil.get(getActivity(), "addressStr", "");
        textAddress.setText("地址: " + addressStr);
        categoryStr = (String) SharePreferenceUtil.get(getActivity(), "categoryStr", "");
        textCategory.setText(categoryStr);
        supplierId = (String) SharePreferenceUtil.get(getActivity(), "supplierId", "");

        return v;
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.layout_ziZhi, R.id.layout_jubao})
    public void onViewClicked(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.layout_ziZhi:
//                startActivity(new Intent(getActivity(), ChaKanZiZhiActivity.class));
                intent = new Intent(getActivity(), ChaKanZiZhiActivity.class);
                intent.putExtra("supplierId", supplierId);
                startActivity(intent);
                break;
            case R.id.layout_jubao:

                intent = new Intent(getActivity(), JuBaoActivity.class);

                startActivity(intent);
                break;
        }
    }


}